import {
	PortalViewActionType,
	IPortalViewAbility,
	IPortalViewControllerParams,
	IPortalViewModel,
	IPortalViewStore,
	IParam,
	IViewEvent,
} from '@/core';
import { QXEvent } from 'qx-util';
import {
	getViewClassNames,
	useViewAction,
	useViewBasic,
	useViewControllerParams,
	useViewProps,
} from '../use-view';

/**
 * 获取应用看板数据视图输入参数
 *
 * @export
 * @return {*}
 */
export function usePortalViewProps() {
	return {
		...useViewProps(),
        noViewCaption: {
			type: Boolean,
			default: true,
		},
	};
}

/**
 * 获取应用看板数据视图基础
 *
 * @export
 * @param {IPortalViewModel} model 应用看板数据视图模型
 * @param {IParam} props 输入参数
 * @return {*}
 */
export function usePortalViewBasic(model: IPortalViewModel,props: IParam) {
	const getClassNames = (props:IParam) =>{
		return getViewClassNames(model, props)
	}
	return {
		...useViewBasic(model,props),
		getClassNames,
	};
}

/**
 * 应用看板数据视图行为
 *
 * @export
 */
export function usePortalViewAction(controller: any) {
	return {
		...useViewAction(controller),
	};
}

/**
 * 获取应用看板数据视图控制器输入参数
 *
 * @export
 * @param {IPortalViewModel} model
 * @param {IParam} props
 * @param {QXEvent<IViewEvent<PortalViewActionType, IPortalViewAbility>>} evt
 * @return {*}  {IPortalViewControllerParams<PortalViewActionType, IPortalViewAbility>}
 */
export function usePortalViewControllerParams(
	model: IPortalViewModel,
	props: IParam,
	evt: QXEvent<IViewEvent<PortalViewActionType, IPortalViewAbility>>
): IPortalViewControllerParams<PortalViewActionType, IPortalViewAbility> {
	return {
		...useViewControllerParams<IPortalViewStore, IPortalViewModel>(
			model,
			props,
			evt
		),
	};
}
